//使用字符数组存储字符串
#include <stdio.h>

int main(void)
{
	char str[5] = {'a'};
    str[0] = 'b';
	//printf("&str[0] = %p\n",&str[0]);
	int i = 0;
	for(i = 0; i < 5; i++)
	{
		printf("str[%d] = %c[%d]\n",i,str[i],str[i]);
	}

    printf("--------------------\n");
    char str2[6] = {'h','e','l','l','o','w'};	
	//printf("&str2[6] = %p\n",&str2[6]);
	printf("str2 = %s\n",str2);

	printf("------------------\n");
	char str3[10] = {'h','e','l','l','o','\0','a','b','c','d'};
	printf("str3 = %s\n",str3);
	
	printf("-------------------\n");
	char str4[6] = "hello";
	printf("str4 = %s\n",str4);
	printf("字符串的长度是：%d,%d\n",sizeof(str4),sizeof("hello"));

	printf("------------------\n");
	char* pStr = "hello";
	printf("pStr = %s\n",pStr);
	printf("pStr = %p\n",pStr);
	printf("字符串的首地址是：%p\n",&"hello"[0]);
	//"hello"[0] = 'b'; 不可改变
	//*pStr = 'b';
	pStr = str;
	*pStr = 'b';
	return 0;
}
